package org.example.Day11;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;


public class Client {
    public static void main(String[] args) throws Exception{
        //创建客户端对象
        DatagramSocket socket = new DatagramSocket(7777);
        //数据包对象封装要发出去的数据
        byte[] bytes = "我是客户端".getBytes();
        DatagramPacket packet = new DatagramPacket(bytes,bytes.length, InetAddress.getLocalHost(),6666);
        socket.send(packet);
        System.out.println("客户端数据发送完毕");
        socket.close();
    }
}
